/**
 * CriticalInstall.js
 *
 * @description :: A model definition represents a database table/collection.
 * @docs        :: https://sailsjs.com/docs/concepts/models-and-orm/models
 */

module.exports = {

  attributes: {

    //  ╔═╗╦═╗╦╔╦╗╦╔╦╗╦╦  ╦╔═╗╔═╗
    //  ╠═╝╠╦╝║║║║║ ║ ║╚╗╔╝║╣ ╚═╗
    //  ╩  ╩╚═╩╩ ╩╩ ╩ ╩ ╚╝ ╚═╝╚═╝
    installedAt: {
      example: 1670152500000,
      description: 'JS timestamp representing when this installation began on the host.',
      type: 'number',
      isInteger: true,
      required: true,
    },

    versionName: {
      type: 'string',
      description: 'The version of the critical softare that was installed.',
      required: true,
    },

    softwareName: {
      type: 'string',
      description: 'The name of the critical software that was installed.',
      required: true,
    },

    platform: {
      description: 'The platform that this software is used on.',
      extendedDescription: 'This value is used to display the operating system that this software is installed on when users are setting compliant versions.',
      type: 'string',
      required: true,
    },

    fleetApid: {
      type: 'number',
      description: 'The Fleet API ID of the critical software that was installed.',
      required: true,
    },

    softwareType: {
      type: 'string',
      description: 'The type of critical software.',
      required: true,
      isIn: [
        'chrome',
        'firefox',
        'safari',
        'microsoftOffice',
        'flash',
      ],
    },

    isCompliant: {
      type: 'boolean',
      description: 'Whether this software is in the list of acceptable versions',
      defaultsTo: false,
    },

    //  ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
    //  ║╣ ║║║╠╩╗║╣  ║║╚═╗
    //  ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝


    //  ╔═╗╔═╗╔═╗╔═╗╔═╗╦╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
    //  ╠═╣╚═╗╚═╗║ ║║  ║╠═╣ ║ ║║ ║║║║╚═╗
    //  ╩ ╩╚═╝╚═╝╚═╝╚═╝╩╩ ╩ ╩ ╩╚═╝╝╚╝╚═╝

    host: {
      model: 'Host',
      required: true,
    },

  },

};

